template <typename Resource, typename Identifier>
void ResourceHolder<Resource, Identifier>::load(Identifier id, const std::string & filename)
{
	// stworzenie i zaladowanie zasobu:
	std::unique_ptr<Resource> resource(new Resource());
	if (!resource->loadFromFile(filename))
		throw std::runtime_error("ResourceHolder::load - Failed to load " + filename);

	// jak sie zaladowalo, wrzucamy do mapki:
	insertResource(id, std::move(resource));
}

template <typename Resource, typename Identifier>
template <typename Parameter>
void ResourceHolder<Resource, Identifier>::load(Identifier id, const std::string & filename, const Parameter & secondParam)
{
	// stworzenie i zaladowanie zasobu:
	std::unique_ptr<Resource> resource(new Resource());
	if (!resource->loadFromFile(filename, secondParam))
		throw std::runtime_error("ResourceHolder::load - Failed to load " + filename);

	// jak sie zaladowalo, wrzucamy do mapki:
	insertResource(id, std::move(resource));
}

template <typename Resource, typename Identifier>
Resource & ResourceHolder<Resource, Identifier>::get(Identifier id)
{
	auto found = m_resourceMap.find(id); // szukamy zasobu o danym id
	assert(found != m_resourceMap.end()); // jak nie znalazlo, no to dupa

	return *found->second; // zwracamy szukany zasob
}

template <typename Resource, typename Identifier>
const Resource & ResourceHolder<Resource, Identifier>::get(Identifier id) const
{
	auto found = m_resourceMap.find(id); // szukamy zasobu o danym id
	assert(found != m_resourceMap.end()); // jak nie znalazlo, no to dupa

	return *found->second; // zwracamy szukany zasob
}

template <typename Resource, typename Identifier>
void ResourceHolder<Resource, Identifier>::insertResource(Identifier id, std::unique_ptr<Resource> resource) 
{
	// wrzucamy zasobi do mapki i sprawdzamy czy sie udalo:
	auto inserted = m_resourceMap.insert(std::make_pair(id, std::move(resource)));
	assert(inserted.second);
}